<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
	<meta http-equiv="Cache-Control" content="no-siteapp"/>
	<link rel="Bookmark" href="../../imgs/bai.ico">
	<link rel="Shortcut Icon" href="../../imgs/bai.ico"/>
	<link rel="stylesheet" type="text/css" href="../../css/static/H-ui.min.css" />
	<link rel="stylesheet" type="text/css" href="../../css/static/H-ui.admin.css" />
	<link rel="stylesheet" type="text/css" href="../../css/lib/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="../../css/views.css" />
	<title>管理后台</title>
	<style type="text/css">
		#tableMore { cursor: pointer; display: none; }
		#tableMore:hover { background: #F8F8F8; font-weight: bolder; }
	</style>
</head>
<body>
	<nav class="breadcrumb">
		<a href="javascript:;" class="maincolor" onclick="toHome();">
			<i class="Hui-iconfont">&#xe67f;</i> 首页
		</a>
		<span class="c-gray en">&gt;</span>微信用户
	</nav>
	<div class="Hui-article">
		<article class="cl pd-20">
			<div class="mt-20">
				<table class="table table-border table-bordered table-hover table-bg table-sort">
					<thead>
					<tr class="text-c">
						<th width="50">ID</th>
						<th width="100">手机号</th>
						<th width="100">微信昵称</th>
						<th width="100">微信头像</th>
						<th width="100">首次时间</th>
						<th width="100">最近时间</th>
					</tr>
					</thead>
					<tbody id="formList">
					<tr class="text-c">
						<td colspan="10" style="text-align: center;">没有记录</td>
					</tr>
					</tbody>
				</table>
				<br/>
				<table class="table table-border table-bordered table-hover table-bg table-sort" id="tableMore" onclick="getIndex();">
					<tr class="text-c">
						<td title="点击更多">更多记录</td>
					</tr>
				</table>
			</div>
		</article>
	</div>

	<!-- msg弹窗 -->
	<span id="msgPop"></span>
</body>
</html>


<script type="text/javascript" src="../../js/lib/jquery.min.js"></script>
<script type="text/javascript" src="../../js/lib/layer.js"></script>
<script type="text/javascript" src="../../js/static/H-ui.js"></script>
<script type="text/javascript" src="../../js/static/H-ui.admin.page.js"></script>
<script type="text/javascript" src="../../js/config.js"></script>
<script type="text/javascript" src="../../js/view.js"></script>
<script type="text/javascript">
	var formList = {
		data: [],
		pages: {start: 0, limit: 10}
	}; //数据列表
	(function () {
		getIndex();
	})();
	//列表
	function getIndex(){
		var formData = {
			aid: getAid(),
			pageStart: formList.pages.start,
			pageLimit: formList.pages.limit
		};
		console.log(formData);
		$.ajax({
			type: apis.weixinIndex.method,
			url: domain + apis.weixinIndex.url,
			data: formData,
			success: function (res) {
				console.log(res);
				if (res.code != 0) {
					if (formList.pages.start > 0) {
						msgPop({msg: res.msg});
					}
					return
				}
				for (var i = 0; i < res.data.length; i ++) {
					formList.data.push(res.data[i]);
				}
				formList.pages.start ++;
				getHtml();
			},
			error: function () {
				console.log('网络错误');
			}
		});
	}
	//列表字符串
	function getHtml(){
		var h = '', i, d = formList.data, phone, head, lasttime;
		h += '';
		for (i = 0; i < d.length; i ++) {
			phone = d[i].phone==null ? '' : d[i].phone;
			head = d[i].avatarUrl==null ? '' : '<img src="' + d[i].avatarUrl + '" width="50"/>';
			lasttime = d[i].uptime ? d[i].uptime : '-';
			h += '<tr class="text-c">';
			h += '<td>' + d[i].id + '</td>';
			h += '<td>' + phone + '</td>';
			h += '<td>' + d[i].username + '</td>';
			h += '<td>' + head + '</td>';
			h += '<td>' + d[i].addtime + '</td>';
			h += '<td>' + lasttime + '</td>';
			h += '</tr>';
		}
		h += '';
		$('#formList').html(h);
		$('#tableMore').show();
	}
</script>